package br.mil.pamerj.efetivo.webservices;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import br.mil.pamerj.efetivo.model.entity.Pais;
import br.mil.pamerj.efetivo.services.interfaces.IPaisService;
import br.mil.pamerj.efetivo.services.interfaces.IServiceFactory;
import br.mil.pamerj.efetivo.services.util.ServiceUtil;

@WebService
public class EfetivoWS {
	@WebMethod(operationName = "concatenaString")
	public String concatenaString(@WebParam(name="str1") String str1, @WebParam(name="str2") String str2) {
		
	
		return str1+str2;
	}

	@WebMethod(operationName = "getPais")
	public Pais carregaPais(@WebParam(name="paisId") long paisId) {
			
		Pais pais =null;
		IServiceFactory factory = ServiceUtil.getServiceFactory();
		IPaisService service = factory.getPaisService();
		pais = service.load(paisId);
	
		return pais;
	}
	
	@WebMethod(operationName = "listaPaises")
	public List<Pais> listaPaises() {
			
		List<Pais> lista =null;
		IServiceFactory factory = ServiceUtil.getServiceFactory();
		IPaisService service = factory.getPaisService();
		lista = service.retrieve();
	
		return lista;
	}

}
